modifier_endure_improve = class({})
require('abilities/modifiers/common_modifiers')
function modifier_endure_improve:OnCreated()
	self.reduce_damage_percent = self:GetAbility():GetSpecialValueFor("reduce_damage_percent")
	self.melee_max_health = self:GetAbility():GetSpecialValueFor("melee_max_health")
	self.ranged_max_health = self:GetAbility():GetSpecialValueFor("ranged_max_health")
	self.mechanical_max_health = self:GetAbility():GetSpecialValueFor("mechanical_max_health")
	common_modifiers:RegisterCommonModifier(self,false)
end
function modifier_endure_improve:OnDestroy()
end
function modifier_endure_improve:DeclareFunctions()
    local funcs = {
        MODIFIER_PROPERTY_HEALTH_BONUS,
        MODIFIER_PROPERTY_MAGICAL_RESISTANCE_BONUS,
    }
    return funcs
end
function modifier_endure_improve:GetModifierMagicalResistanceBonus()
	return self:GetStackCount() * self.reduce_damage_percent
end
function modifier_endure_improve:GetModifierHealthBonus()
	local ability = self:GetAbility()
	if self:GetParent():IsMechanical() then
		return self:GetStackCount() * self.mechanical_max_health
	elseif self:GetParent():GetAttackCapability() == DOTA_UNIT_CAP_MELEE_ATTACK then
		return self:GetStackCount() * self.melee_max_health
	elseif self:GetParent():GetAttackCapability() == DOTA_UNIT_CAP_RANGED_ATTACK then
		return self:GetStackCount() * self.ranged_max_health
	end
	return 0
end
function modifier_endure_improve:GetModifierPhysicalArmorBonus()
	return self:GetStackCount() * self.armor_bonus
end